﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace WindowsFormsApplication1.Classes
{
    class DartGame
    {

        private int x01pts = 301;
        bool usecricketpts = true;
        bool x01dblon = false;



        public enum GameType
        {
            Cricket,
            x01,
            DoublesCricket,
            Doublesx01,
            PracticeDoubles,
            PracticeTriples,
            AroundTheWorld

        }

                


        public GameType game = GameType.Cricket;


        #region constructors
        /// <summary>
        /// X01 Game constructor
        /// </summary>
        /// <param name="game">Type of the game being started. ('01, Cricket, etc)</param>
        /// <param name="players">Array of players names in the order they will be throwing.</param>
        /// <param name="x01points">What number will the game start counting down from?</param>
        /// <param name="doubleon">Will a double be required to start the game?</param>
        public DartGame(string game, Player[] players, int x01points, bool doubleon)
        {
            this.game = (GameType)Enum.Parse(typeof(GameType), game);

            this.x01dblon = doubleon;
            this.x01pts = x01points;


        }
        /// <summary>
        /// Cricket Game Constructor
        /// </summary>
        /// <param name="game">Type of the game being started. ('01, Cricket, etc)</param>
        /// <param name="players">Array of players names in the order they will be throwing.</param>
        /// <param name="usepoints">Will points be allowed during the game if a number remains open?</param>
        public DartGame(string game, Player[] players, bool usepoints)
        {
            this.game = (GameType)Enum.Parse(typeof(GameType), game);

            this.usecricketpts = usepoints;


        }

        #endregion

        #region OptionalProperties

        /// <summary>
        /// Sets the Starting value for '01 games.
        /// </summary>
        [Description("Starting value for '01 games."),Category("Parameters"),DefaultValue(0)]
        public int X01Points
        {
            get { return this.x01pts; }
            //set //only set during contstructor?
            //{
            //    if (game == GameType.Doublesx01 || game == GameType.x01)
            //    {
            //        this.x01pts = value;
            //    }
            //}
        }

        /// <summary>
        /// Sets the option for whether or not to use points in Cricket.
        /// </summary>
        [Description("Sets the option for whether or not to use points in Cricket."), Category("Parameters"), DefaultValue(true)]
        public bool UseCricketPoints
        {
            get { return this.usecricketpts; }

            //set  //only set during constructor? 
            //{
            //    if (game == GameType.Cricket || game == GameType.DoublesCricket)
            //    {
            //        this.usecricketpts = value;
            //    }

            //}
        }
        #endregion






    }
}
